package WebSum6;


import org.apache.hadoop.io.FloatWritable;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class WebSumReducer extends Reducer<WebCountBean, FloatWritable, WebCountBean,FloatWritable> {

    FloatWritable outValue = new FloatWritable();

    @Override
    protected void reduce(WebCountBean key, Iterable<FloatWritable> values, Reducer<WebCountBean, FloatWritable, WebCountBean, FloatWritable>.Context context) throws IOException, InterruptedException {
        float totalweb = 0;

        for (FloatWritable value : values){
            totalweb += value.get();
        }
        outValue.set(totalweb);
        context.write(key,outValue);
    }
}
